#define _CRT_SECURE_NO_WARNINGS 1



#include<stdio.h>
#include<stdlib.h>
#include<string.h>


typedef struct SLNode
{
	int data;
	struct SLNode* next;
} SLNode;
typedef SLNode* LinkList;
int ListInit(LinkList *L)
{
	if (L == NULL)
		return 0;
	*L = NULL;
	return 1;
}
int ListInsert(LinkList* L, int i, int x)
{
	if (L == NULL || i < 1)
		return 0;
	SLNode* p = *L;
	int j = 1;
	if (i == 1)
	{
		SLNode* q = (SLNode*)malloc(sizeof(SLNode));
		q->data = x;
		q->next = p;
		*L = q;
		return 1;
	}
	while (p != NULL && j < i)
	{
		p = p->next;
		j++;
	}
	if (p == NULL)
		return 0;
	SLNode* q = (SLNode*)malloc(sizeof(SLNode));
	q->data = x;
	q->next = p->next;
	p->next = q;
}
int main()
{
	LinkList L;
	ListInit(&L);
	int i = 0, ret = 0;
	for (i = 1; i <= 10; i++)
	{
		ret = ListInsert(&L, i, i);
	}

	return 0;
}